// const 模拟枚举类型
// const ErrorEnum = {
//     SUCCESS: { code: 200, msg: "成功" },
//     FAILED: { code: 300, msg: "失败" },
//     PARAMS_VALID_ERROR: { code: 310, msg: "参数校验错误" },
//     PARAMS_TYPE_ERROR: { code: 311, msg: "参数类型错误" },
//     REQUEST_METHOD_ERROR: { code: 312, msg: "请求方法错误" },
//     ASSERT_ARGUMENT_ERROR: { code: 313, msg: "断言参数错误" },
//     // ASSERT_MYBATIS_ERROR: { code: 314, msg: "断言Mybatis错误" },
//     DB_ERROR: { code: 314, msg: "数据库相关错误，包括数据库业务上的失败，如查询用户不存在等" },
//     LOGIN_ACCOUNT_ERROR: { code: 330, msg: "登录账号或密码错误" },
//     LOGIN_DISABLE_ERROR: { code: 331, msg: "登录账号已被禁用了" },
//     TOKEN_EMPTY: { code: 332, msg: "token参数为空" },
//     TOKEN_INVALID: { code: 333, msg: "token参数无效" },
//     CAPTCHA_ERROR: { code: 334, msg: "验证码错误" },
//     CAPTCHA_EXPIRED: { code: 334, msg: "验证码已过期" },
//     PAYMENT_ERROR: { code: 335, msg: "发起支付失败" },
//     USER_EXIST: { code: 336, msg: "用户已存在" },
//     USER_NOT_EXIST: { code: 337, msg: "用户不存在" },
//     UPLOAD_FILE_ERROR: { code: 338, msg: "文件上传失败" },
//     OlD_PASSWORD_ERROR: { code: 339, msg: "原密码错误" },
//     NO_PERMISSION: { code: 403, msg: "无相关权限" },
//     REQUEST_404_ERROR: { code: 404, msg: "请求接口不存在" },
//     SYSTEM_ERROR: { code: 500, msg: "系统错误" }
// } as const;

const ErrorEnum = {
    // ================== 基础错误 (1000-1999) ==================
    SUCCESS: { code: 1000, httpStatus: 200, msg: "操作成功" },
    FAILED: { code: 1001, httpStatus: 500, msg: "操作失败" },
    SYSTEM_ERROR: { code: 1002, httpStatus: 500, msg: "系统内部错误" },
    SERVICE_UNAVAILABLE: { code: 1003, httpStatus: 503, msg: "服务暂时不可用" },
    API_DEPRECATED: { code: 1004, httpStatus: 410, msg: "API已弃用" },

    // ================== 参数错误 (2000-2999) ==================
    PARAMS_VALID_ERROR: { code: 2000, httpStatus: 400, msg: "参数校验失败" },
    PARAMS_TYPE_ERROR: { code: 2001, httpStatus: 400, msg: "参数类型错误" },
    PARAMS_MISSING: { code: 2002, httpStatus: 400, msg: "必要参数缺失" },
    PARAMS_FORMAT_ERROR: { code: 2003, httpStatus: 400, msg: "参数格式错误" },
    REQUEST_METHOD_ERROR: { code: 2004, httpStatus: 405, msg: "请求方法不允许" },

    // ================== 认证授权 (3000-3999) ==================
    UNAUTHORIZED: { code: 3000, httpStatus: 401, msg: "未授权访问" },
    FORBIDDEN: { code: 3001, httpStatus: 403, msg: "访问权限不足" },
    TOKEN_INVALID: { code: 3002, httpStatus: 401, msg: "凭证无效" },
    TOKEN_EXPIRED: { code: 3003, httpStatus: 401, msg: "凭证已过期" },
    TOKEN_EMPTY: { code: 3004, httpStatus: 401, msg: "凭证缺失" },
    CAPTCHA_ERROR: { code: 3005, httpStatus: 401, msg: "验证码错误" },
    CAPTCHA_EXPIRED: { code: 3006, httpStatus: 401, msg: "验证码已过期" },
    LOGIN_FAILED: { code: 3007, httpStatus: 401, msg: "登录失败" },
    ACCOUNT_LOCKED: { code: 3008, httpStatus: 403, msg: "账号已被锁定" },
    PASSWORD_EXPIRED: { code: 3009, httpStatus: 403, msg: "密码已过期" },
    OLD_PASSWORD_ERROR: { code: 3010, httpStatus: 400, msg: "原密码错误" },

    // ================== 用户相关 (4000-4999) ==================
    USER_EXIST: { code: 4000, httpStatus: 409, msg: "用户已存在" },
    USER_NOT_FOUND: { code: 4001, httpStatus: 404, msg: "用户不存在" },
    USER_DISABLED: { code: 4002, httpStatus: 403, msg: "用户已被禁用" },
    USER_AVATAR_ERROR: { code: 4003, httpStatus: 400, msg: "头像上传失败" },
    USER_PROFILE_ERROR: { code: 4004, httpStatus: 400, msg: "资料更新失败" },

    // ================== 业务操作 (5000-5999) ==================
    OPERATION_FAILED: { code: 5000, httpStatus: 400, msg: "操作执行失败" },
    DATA_NOT_FOUND: { code: 5001, httpStatus: 404, msg: "数据不存在" },
    DATA_EXISTS: { code: 5002, httpStatus: 409, msg: "数据已存在" },
    DATA_INVALID: { code: 5003, httpStatus: 400, msg: "数据状态异常" },
    DATA_DUPLICATION: { code: 5004, httpStatus: 409, msg: "数据重复提交" },

    // ================== 文件操作 (6000-6999) ==================
    FILE_UPLOAD_ERROR: { code: 6000, httpStatus: 400, msg: "文件上传失败" },
    FILE_DOWNLOAD_ERROR: { code: 6001, httpStatus: 400, msg: "文件下载失败" },
    FILE_TYPE_ERROR: { code: 6002, httpStatus: 400, msg: "文件类型不支持" },
    FILE_SIZE_EXCEEDED: { code: 6003, httpStatus: 400, msg: "文件大小超出限制" },
    FILE_NOT_FOUND: { code: 6004, httpStatus: 404, msg: "文件不存在" },
    FILE_ALREADY_EXISTS: { code: 6005, httpStatus: 409, msg: "文件已存在" },
    FILE_DELETE_ERROR: { code: 6006, httpStatus: 400, msg: "文件删除失败" },

    // ================== 第三方服务 (7000-7999) ==================
    PAYMENT_ERROR: { code: 7000, httpStatus: 400, msg: "支付服务异常" },
    SMS_SEND_ERROR: { code: 7001, httpStatus: 400, msg: "短信发送失败" },
    EMAIL_SEND_ERROR: { code: 7002, httpStatus: 400, msg: "邮件发送失败" },
    THIRD_PARTY_TIMEOUT: { code: 7003, httpStatus: 504, msg: "第三方服务超时" },

    // ================== 数据库相关 (8000-8999) ==================
    DB_CONNECTION_ERROR: { code: 8000, httpStatus: 500, msg: "数据库连接失败" },
    DB_QUERY_ERROR: { code: 8001, httpStatus: 500, msg: "数据库查询异常" },
    DB_TRANSACTION_ERROR: { code: 8002, httpStatus: 500, msg: "数据库事务异常" },
    DB_DUPLICATE_ENTRY: { code: 8003, httpStatus: 409, msg: "数据库唯一约束冲突" },

    // ================== 系统配置 (9000-9999) ==================
    CONFIG_ERROR: { code: 9000, httpStatus: 500, msg: "系统配置错误" },
    FEATURE_DISABLED: { code: 9001, httpStatus: 501, msg: "功能暂未开放" }
} as const;

export default ErrorEnum;
